package cn.edu.bupt.freewings.forum.client.rest;

import cn.edu.bupt.freewings.forum.common.CommonType;
import cn.edu.bupt.freewings.forum.common.TopicType;
import cn.edu.bupt.freewings.forum.client.Constants;
import cn.edu.bupt.freewings.forum.client.base.ClientUtility;

import org.apache.log4j.Logger;

public class TopicClient {
	Logger logger = Logger.getLogger(UserClient.class.getName());

	public TopicType.TopicList getByProjectId(Integer id) {
		return (TopicType.TopicList) ClientUtility.makeHttpRequest(
				ClientUtility.HTTPMethod.GET, Constants.REST_SERVER + Constants.TOPICS
						+ "/" + id, null, null, Constants.MIME_PROTO,
				TopicType.TopicList.class);
	}

	public void put(TopicType.Topic topic) {
		ClientUtility.makeHttpRequest(ClientUtility.HTTPMethod.PUT,
				Constants.REST_SERVER + Constants.TOPIC + "/new", Constants.MIME_PROTO,
				topic.toByteArray(), Constants.MIME_PROTO, CommonType.Empty.class);
	}
}
